home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / src / mm / break.c.D < prev    next >
Text File  |  1990-07-25  |  4KB  |  123 lines

  1. *** /tmp/,RCSt1022396    Wed Jul 25 13:59:39 1990
  2. --- break.c    Mon Jul 23 16:16:33 1990
  3. ***************
  4. *** 18,25 ****
  5.   
  6. ! #include "../h/const.h"
  7. ! #include "../h/type.h"
  8. ! #include "../h/error.h"
  9. ! #include "../h/signal.h"
  10. ! #include "const.h"
  11. ! #include "glo.h"
  12.   #include "mproc.h"
  13. --- 18,21 ----
  14.   
  15. ! #include "mm.h"
  16. ! #include <signal.h>
  17.   #include "mproc.h"
  18. ***************
  19. *** 39,44 ****
  20.    * the stack pointer can grow beyond the base of the stack segment without
  21. !  * anybody noticing it.    For a file not using separate I & D space,
  22. !  * the parameter, 'addr' is the total size, text + data.  For a file using
  23. !  * separate text and data spaces, it is just the data size. Files using
  24. !  * separate I & D space have the SEPARATE bit in mp_flags set.
  25.    */
  26. --- 35,38 ----
  27.    * the stack pointer can grow beyond the base of the stack segment without
  28. !  * anybody noticing it.
  29. !  * The parameter, 'addr' is the new virtual address in D space.
  30.    */
  31. ***************
  32. *** 51,60 ****
  33.     rmp = mp;
  34. !   v = (vir_bytes) addr;        /* 'addr' is the new data segment size */
  35.     new_clicks = (vir_clicks) ( ((long) v + CLICK_SIZE - 1) >> CLICK_SHIFT);
  36. - #ifdef ATARI_ST
  37. -   /*
  38. -    * Probably not ATARI_ST specific. 'addr' is a virtual address,
  39. -    * not an offset in D space.
  40. -    * Cleanup some comments above as well.
  41. -    */
  42.     if (new_clicks < rmp->mp_seg[D].mem_vir) {
  43. --- 45,48 ----
  44.     rmp = mp;
  45. !   v = (vir_bytes) addr;
  46.     new_clicks = (vir_clicks) ( ((long) v + CLICK_SIZE - 1) >> CLICK_SHIFT);
  47.     if (new_clicks < rmp->mp_seg[D].mem_vir) {
  48. ***************
  49. *** 64,66 ****
  50.     new_clicks -= rmp->mp_seg[D].mem_vir;
  51. - #endif
  52.     sys_getsp(who, &new_sp);    /* ask kernel for current sp value */
  53. --- 52,53 ----
  54. ***************
  55. *** 68,70 ****
  56.     res_ptr = (r == OK ? addr : (char *) -1);
  57. !   return(r);            /* return new size or -1 */
  58.   }
  59. --- 55,57 ----
  60.     res_ptr = (r == OK ? addr : (char *) -1);
  61. !   return(r);            /* return new address or -1 */
  62.   }
  63. ***************
  64. *** 95,96 ****
  65. --- 82,85 ----
  66.   
  67. +   if(rmp - mproc == INIT_PROC_NR) return(OK);    /* don't bother init */
  68.     /* See if stack size has gone negative (i.e., sp too close to 0xFFFF...) */
  69. ***************
  70. *** 103,105 ****
  71.     lower = (delta > 0 ? sp_click : mem_sp->mem_vir);
  72. !   gap_base = mem_dp->mem_vir + data_clicks;
  73.     if (lower < gap_base) return(ENOMEM);    /* data and stack collided */
  74. --- 92,98 ----
  75.     lower = (delta > 0 ? sp_click : mem_sp->mem_vir);
  76. !   /* Add a safety margin for future stack growth. Impossible to do right. */
  77. ! #define SAFETY_BYTES  (384 * sizeof(char *))
  78. ! #define SAFETY_CLICKS ((SAFETY_BYTES + CLICK_SIZE - 1) / CLICK_SIZE)
  79. !   gap_base = mem_dp->mem_vir + data_clicks + SAFETY_CLICKS;
  80.     if (lower < gap_base) return(ENOMEM);    /* data and stack collided */
  81. ***************
  82. *** 159,161 ****
  83.   
  84. ! #ifndef ATARI_ST
  85.     int pt, pd, ps;        /* segment sizes in pages */
  86. --- 152,154 ----
  87.   
  88. ! #if (PAGE_SIZE > 1)
  89.     int pt, pd, ps;        /* segment sizes in pages */
  90. ***************
  91. *** 162,166 ****
  92.   
  93. !   pt = (int) ( ((long)tc << CLICK_SHIFT) + PAGE_SIZE - 1)/PAGE_SIZE;
  94. !   pd = (int) ( ((long)dc << CLICK_SHIFT) + PAGE_SIZE - 1)/PAGE_SIZE;
  95. !   ps = (int) ( ((long)sc << CLICK_SHIFT) + PAGE_SIZE - 1)/PAGE_SIZE;
  96.   
  97. --- 155,159 ----
  98.   
  99. !   pt = ( (tc << CLICK_SHIFT) + PAGE_SIZE - 1)/PAGE_SIZE;
  100. !   pd = ( (dc << CLICK_SHIFT) + PAGE_SIZE - 1)/PAGE_SIZE;
  101. !   ps = ( (sc << CLICK_SHIFT) + PAGE_SIZE - 1)/PAGE_SIZE;
  102.   
  103. ***************
  104. *** 182,184 ****
  105.    *===========================================================================*/
  106. ! PUBLIC stack_fault(proc_nr)
  107.   int proc_nr;            /* tells who got the stack fault */
  108. --- 175,177 ----
  109.    *===========================================================================*/
  110. ! PUBLIC void stack_fault(proc_nr)
  111.   int proc_nr;            /* tells who got the stack fault */
  112. ***************
  113. *** 195,197 ****
  114.     sys_getsp((int)(rmp - mproc), &new_sp);
  115. ! #ifdef ATARI_ST
  116.     new_sp -= CLICK_SIZE;        /* one click margin between D and S */
  117. --- 188,190 ----
  118.     sys_getsp((int)(rmp - mproc), &new_sp);
  119. ! #if (CHIP == M68000)
  120.     new_sp -= CLICK_SIZE;        /* one click margin between D and S */
  121.